package main.validator.impl;

import java.util.Map;

import main.validator.Validator;
import main.validator.ValidatorEx;


public class CustomValidator implements Validator, ValidatorEx {

	//����У����
	private Validator thirdpartyValidator = null;
	
	public Validator getThirdpartyValidator() {
		return thirdpartyValidator;
	}

	public CustomValidator(Validator thirdpartyValidator) {
		super();
		this.thirdpartyValidator = thirdpartyValidator;
	}

	public boolean check(Map<String, String> attributes, String value) {
		if(null != this.thirdpartyValidator){
			return this.thirdpartyValidator.check(attributes, value);
		}
		else{
			return true;
		}
	}

	public boolean check(Map<String, String> attributes, String[] values) {
		if(null != this.thirdpartyValidator){
			return this.thirdpartyValidator.check(attributes, values);
		}
		else{
			return true;
		}
	}

	@Override
	public boolean check(Map<String, String> attributes,
			Map<Object, Object> values) {
		if(null != this.thirdpartyValidator && this.thirdpartyValidator instanceof ValidatorEx ){
			return ((ValidatorEx)this.thirdpartyValidator).check(attributes, values);
		}
		else{
			return true;
		}
	}
}
